package com.woniuxy.mini;

import com.woniuxy.core.service.RankingService;
import com.woniuxy.entity.VO.RenkingVO;
import com.woniuxy.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@RestController
@RequestMapping("renking")
public class RankingController {
    @Autowired
    private RankingService rankingService;
    //获取排行榜
    @GetMapping("/getTopRankings")
    public ResponseData getTopRankings(){
        return ResponseData.ok(rankingService.getTopRankings(10));
    }
    //更新排行榜
//    @GetMapping("/")
//    public ResponseData
    //更新赚钱信息
    @PostMapping("/updateRanking/{userId}/{earnings}")
    public ResponseData updateRanking(@PathVariable("userId") Integer userId,
                                      @PathVariable("earnings") BigDecimal earnings){
        System.out.println("renkingVO"+userId);
        rankingService.updateRanking(userId,earnings);
        return ResponseData.ok();
    }
}
